<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<title></title>
		<link rel="stylesheet" type="text/css" href="/home/css/_reset.css" />
		<link rel="stylesheet" type="text/css" href="/home/css/bootstrap.min.css" />
		<link rel="stylesheet" type="text/css" href="/home/css/iconfont.css" />
		<link rel="stylesheet" type="text/css" href="/home/css/contact.css" />
	</head>
	<body style="overflow-x: hidden;">
		<div class="contact">
			<div class="top">
				<a href="javascript:history.back(-1)" class="back">
					<i class="iconfont">&#xe615;</i></a>
				联系电话
			</div>
			<div class="numb">
				<p>旧手机号码： <input type="text" value="{$list.u_phone}"/></p>
				<p>新手机号码： <input type="text" value="" placeholder="输入手机号码" id="phone"/></p>
			</div>
			<button id="btn">确定修改</button>
		</div>
	</body>
</html>
<script src="/home/js/jquery-2.1.0.js" type="text/javascript" charset="utf-8"></script>
<script src="/home/js/iconfont.js" type="text/javascript" charset="utf-8"></script>
<script src="/home/js/bootstrap.min.js" type="text/javascript" charset="utf-8"></script>
<script src="/home/layer/layer.js"></script>
<script type="text/javascript">
	/* 修改联系方式 */
	$("#btn").click( function () { 
		var phone = $('#phone').val();
		var reg = /^1[345678]\d{9}$/; 
	    if(phone===""){

	    	layer.msg('新手机号码不能为空',{icon:5});

	    	return false;

	    }else if(!reg.test(phone)){
	 
	        layer.msg('新手机号码格式错误',{icon:5});
	        
	        return false;

	    }else{
			$.post('/home/user/editcontact',{u_phone:phone},function(res){
				if(res.msg=="修改成功"){
					layer.msg('修改成功',{icon:6});
					setTimeout(function(){
		                window.location.href="/home/user/home";
		            },1000);
				}else if(res.msg=="修改失败"){
					layer.msg('服务器出错',{icon:5});
				}
			});
		}
	});
</script>
{/block}